package com.jacky.webflux.jwt.service;

import com.jacky.webflux.jwt.models.UserModel;
import com.jacky.webflux.jwt.reposities.UserRepository;
import org.springframework.stereotype.Service;
import reactor.core.publisher.Mono;

@Service
public class UserServiceImpl implements UserService{

    private final UserRepository userRepository;

    public UserServiceImpl(UserRepository userRepository) {
        this.userRepository = userRepository;
    }

    @Override
    public Mono<UserModel> saveUser(UserModel um) {
        return userRepository.save(um);
    }

    @Override
    public Mono<UserModel> findByUsername(String userName) {
        return userRepository.findByUserName(userName);
    }
}
